/***************************************************************************
 *   Copyleft 2006-2007 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __POINT4D_H__
#define __POINT4D_H__

#include "../../Types/Types.h"
#include "../Output/Serializable.h"

class Point4D: public Serializable {
public:
	union {
		struct {
			cFloat mValues[4];
		};
		struct {
			cFloat mX;
			cFloat mY;
			cFloat mZ;
			cFloat mW;
		};
	};

    /**************************************************************
    * Constructors                                                *
    ***************************************************************/
	Point4D(): mX(0.0f), mY(0.0f), mZ(0.0f), mW(1.0f) { }
	Point4D(cFloat fX, cFloat fY, cFloat fZ);
	Point4D(cFloat fX, cFloat fY, cFloat fZ, cFloat fW);
	Point4D(const Point4D& point);
	~Point4D() { }
        
    /**************************************************************
    * Operators                                                   *
    ***************************************************************/
	Point4D operator*(const Point4D& b);
	Point4D operator*(cInt iB);
	Point4D operator*(cFloat fB);
	Point4D operator/(cInt iB);
	Point4D operator/(cFloat fB);
	Point4D operator+(const Point4D& b);
	Point4D operator-(const Point4D& b);
	Point4D operator-();
	Point4D& operator=(const Point4D& point);	
	

	/**************************************************************
    * Other helpful functions                                     *
    ***************************************************************/
	cVoid Normalize();
	cFloat Abs();

	virtual TiXmlElement* Serialize(TiXmlElement* parent);
};                                                                 

#endif // __POINT4D_H__